home *** CD-ROM | disk | FTP | other *** search
/ Inter.Net 55-1 / Inter.Net 55-1.iso / CBuilder / Setup / BCB / data.z / tnef.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-02-09  |  13.9 KB  |  383 lines

  1. /*
  2.  *  T N E F . H
  3.  *
  4.  *
  5.  *  This file contains structure and function definitions for the
  6.  *  MAPI implementation of the Transport Neutral Encapsilation Format
  7.  *  used by MAPI providers for the neutral serialization of a MAPI
  8.  *  message.  This implementation sits on top of the IStream object as
  9.  *  documented in the OLE 2 Specs.
  10.  *
  11.  *  Copyright 1986-1996 Microsoft Corporation. All Rights Reserved.
  12.  */
  13.  
  14. #ifndef TNEF_H
  15. #define TNEF_H
  16. #pragma option push -b
  17.  
  18.  
  19. #ifdef __BORLANDC__
  20. #  include <pshpack8.h>
  21. #endif
  22.  
  23. #ifdef __cplusplus
  24. extern "C" {
  25. #endif
  26.  
  27.  
  28. #ifndef BEGIN_INTERFACE
  29. #define BEGIN_INTERFACE
  30. #endif
  31.  
  32. /* ------------------------------------ */
  33. /* TNEF Problem and TNEF Problem Arrays */
  34. /* ------------------------------------ */
  35.  
  36. typedef struct _STnefProblem
  37. {
  38.     ULONG   ulComponent;
  39.     ULONG   ulAttribute;
  40.     ULONG   ulPropTag;
  41.     SCODE   scode;
  42. } STnefProblem;
  43.  
  44. typedef struct _STnefProblemArray
  45. {
  46.     ULONG           cProblem;
  47.     STnefProblem    aProblem[MAPI_DIM];
  48. } STnefProblemArray, FAR * LPSTnefProblemArray;
  49.  
  50. #define CbNewSTnefProblemArray(_cprob) \
  51.     (offsetof(STnefProblemArray,aProblem) + (_cprob)*sizeof(STnefProblem))
  52. #define CbSTnefProblemArray(_lparray) \
  53.     (offsetof(STnefProblemArray,aProblem) + \
  54.     (UINT) ((_lparray)->cProblem*sizeof(STnefProblem)))
  55.  
  56. /* Pointers to TNEF Interface ---------------------------------------- */
  57.  
  58. DECLARE_MAPI_INTERFACE_PTR(ITnef, LPITNEF);
  59.  
  60. /*  OpenTNEFStream */
  61.  
  62. #define TNEF_DECODE                 ((ULONG) 0)
  63. #define TNEF_ENCODE                 ((ULONG) 2)
  64.  
  65. #define TNEF_PURE                   ((ULONG) 0x00010000)
  66. #define TNEF_COMPATIBILITY          ((ULONG) 0x00020000)
  67. #define TNEF_BEST_DATA              ((ULONG) 0x00040000)
  68. #define TNEF_COMPONENT_ENCODING     ((ULONG) 0x80000000)
  69.  
  70. /*  AddProps, ExtractProps */
  71.  
  72. #define TNEF_PROP_INCLUDE           ((ULONG) 0x00000001)
  73. #define TNEF_PROP_EXCLUDE           ((ULONG) 0x00000002)
  74. #define TNEF_PROP_CONTAINED         ((ULONG) 0x00000004)
  75. #define TNEF_PROP_MESSAGE_ONLY      ((ULONG) 0x00000008)
  76. #define TNEF_PROP_ATTACHMENTS_ONLY  ((ULONG) 0x00000010)
  77. #define TNEF_PROP_CONTAINED_TNEF    ((ULONG) 0x00000040)
  78.  
  79. /*  FinishComponent */
  80.  
  81. #define TNEF_COMPONENT_MESSAGE      ((ULONG) 0x00001000)
  82. #define TNEF_COMPONENT_ATTACHMENT   ((ULONG) 0x00002000)
  83.  
  84. #define MAPI_ITNEF_METHODS(IPURE)                                       \
  85.     MAPIMETHOD(AddProps)                                                \
  86.         (THIS_  ULONG                       ulFlags,                    \
  87.                 ULONG                       ulElemID,                   \
  88.                 LPVOID                      lpvData,                    \
  89.                 LPSPropTagArray             lpPropList) IPURE;          \
  90.     MAPIMETHOD(ExtractProps)                                            \
  91.         (THIS_  ULONG                       ulFlags,                    \
  92.                 LPSPropTagArray             lpPropList,                 \
  93.                 LPSTnefProblemArray FAR *   lpProblems) IPURE;          \
  94.     MAPIMETHOD(Finish)                                                  \
  95.         (THIS_  ULONG                       ulFlags,                    \
  96.                 WORD FAR *                  lpKey,                      \
  97.                 LPSTnefProblemArray FAR *   lpProblems) IPURE;          \
  98.     MAPIMETHOD(OpenTaggedBody)                                          \
  99.         (THIS_  LPMESSAGE                   lpMessage,                  \
  100.                 ULONG                       ulFlags,                    \
  101.                 LPSTREAM FAR *              lppStream) IPURE;           \
  102.     MAPIMETHOD(SetProps)                                                \
  103.         (THIS_  ULONG                       ulFlags,                    \
  104.                 ULONG                       ulElemID,                   \
  105.                 ULONG                       cValues,                    \
  106.                 LPSPropValue                lpProps) IPURE;             \
  107.     MAPIMETHOD(EncodeRecips)                                            \
  108.         (THIS_  ULONG                       ulFlags,                    \
  109.                 LPMAPITABLE                 lpRecipientTable) IPURE;    \
  110.     MAPIMETHOD(FinishComponent)                                         \
  111.         (THIS_  ULONG                       ulFlags,                    \
  112.                 ULONG                       ulComponentID,              \
  113.                 LPSPropTagArray             lpCustomPropList,           \
  114.                 LPSPropValue                lpCustomProps,              \
  115.                 LPSPropTagArray             lpPropList,                 \
  116.                 LPSTnefProblemArray FAR *   lpProblems) IPURE;          \
  117.  
  118. #undef       INTERFACE
  119. #define      INTERFACE  ITnef
  120. DECLARE_MAPI_INTERFACE_(ITnef, IUnknown)
  121. {
  122.     BEGIN_INTERFACE
  123.     MAPI_IUNKNOWN_METHODS(PURE)
  124.     MAPI_ITNEF_METHODS(PURE)
  125. };
  126.  
  127. STDMETHODIMP OpenTnefStream(
  128.     LPVOID              lpvSupport,
  129.     LPSTREAM            lpStream,
  130.     LPTSTR              lpszStreamName,
  131.     ULONG               ulFlags,
  132.     LPMESSAGE           lpMessage,
  133.     WORD                wKeyVal,
  134.     LPITNEF FAR *       lppTNEF);
  135.  
  136. typedef HRESULT (STDMETHODCALLTYPE FAR * LPOPENTNEFSTREAM) (
  137.     LPVOID              lpvSupport,
  138.     LPSTREAM            lpStream,
  139.     LPTSTR              lpszStreamName,
  140.     ULONG               ulFlags,
  141.     LPMESSAGE           lpMessage,
  142.     WORD                wKeyVal,
  143.     LPITNEF FAR *       lppTNEF);
  144.  
  145. STDMETHODIMP OpenTnefStreamEx(
  146.     LPVOID              lpvSupport,
  147.     LPSTREAM            lpStream,
  148.     LPTSTR              lpszStreamName,
  149.     ULONG               ulFlags,
  150.     LPMESSAGE           lpMessage,
  151.     WORD                wKeyVal,
  152.     LPADRBOOK           lpAdressBook,
  153.     LPITNEF FAR *       lppTNEF);
  154.  
  155. typedef HRESULT (STDMETHODCALLTYPE FAR * LPOPENTNEFSTREAMEX) (
  156.     LPVOID              lpvSupport,
  157.     LPSTREAM            lpStream,
  158.     LPTSTR              lpszStreamName,
  159.     ULONG               ulFlags,
  160.     LPMESSAGE           lpMessage,
  161.     WORD                wKeyVal,
  162.     LPADRBOOK           lpAdressBook,
  163.     LPITNEF FAR *       lppTNEF);
  164.  
  165. STDMETHODIMP GetTnefStreamCodepage (
  166.     LPSTREAM            lpStream,
  167.     ULONG FAR *         lpulCodepage,
  168.     ULONG FAR *         lpulSubCodepage);
  169.  
  170. typedef HRESULT (STDMETHODCALLTYPE FAR * LPGETTNEFSTREAMCODEPAGE) (
  171.     LPSTREAM            lpStream,
  172.     ULONG FAR *         lpulCodepage,
  173.     ULONG FAR *         lpulSubCodepage);
  174.  
  175. #define OPENTNEFSTREAM "OpenTnefStream"
  176. #define OPENTNEFSTREAMEX "OpenTnefStreamEx"
  177. #define GETTNEFSTREAMCODEPAGE "GetTnefStreamCodePage"
  178.  
  179. /* -------------------------- */
  180. /* TNEF Signature and Version */
  181. /* -------------------------- */
  182.  
  183. #define MAKE_TNEF_VERSION(_mj,_mn)  (((ULONG)(0x0000FFFF & _mj) << 16) | (ULONG)(0x0000FFFF & _mn))
  184. #define TNEF_SIGNATURE  ((ULONG) 0x223E9F78)
  185. #define TNEF_VERSION    ((ULONG) MAKE_TNEF_VERSION(1,0))
  186.  
  187.  
  188. /* ------------------------------------------- */
  189. /* TNEF Down-level Attachment Types/Structures */
  190. /* ------------------------------------------- */
  191.  
  192. typedef WORD ATYP;
  193. enum { atypNull, atypFile, atypOle, atypPicture, atypMax };
  194.  
  195. #define MAC_BINARY  ((DWORD) 0x00000001)
  196.  
  197. #pragma pack (1)
  198. typedef struct _renddata
  199. {
  200.     ATYP    atyp;
  201.     ULONG   ulPosition;
  202.     WORD    dxWidth;
  203.     WORD    dyHeight;
  204.     DWORD   dwFlags;
  205.  
  206. } RENDDATA, *PRENDDATA;
  207. #pragma pack ()
  208.  
  209.  
  210. /* ----------------------------------- */
  211. /* TNEF Down-level Date/Time Structure */
  212. /* ----------------------------------- */
  213.  
  214. #pragma pack (1)
  215. typedef struct _dtr
  216. {
  217.     WORD    wYear;
  218.     WORD    wMonth;
  219.     WORD    wDay;
  220.     WORD    wHour;
  221.     WORD    wMinute;
  222.     WORD    wSecond;
  223.     WORD    wDayOfWeek;
  224.  
  225. } DTR;
  226. #pragma pack ()
  227.  
  228.  
  229. /* ----------------------------- */
  230. /* TNEF Down-level Message Flags */
  231. /* ----------------------------- */
  232.  
  233. #define fmsNull         ((BYTE) 0x00)
  234. #define fmsModified     ((BYTE) 0x01)
  235. #define fmsLocal        ((BYTE) 0x02)
  236. #define fmsSubmitted    ((BYTE) 0x04)
  237. #define fmsRead         ((BYTE) 0x20)
  238. #define fmsHasAttach    ((BYTE) 0x80)
  239.  
  240.  
  241. /* ----------------------------------------- */
  242. /* TNEF Down-level Triple Address Structures */
  243. /* ----------------------------------------- */
  244.  
  245. #define trpidNull                   ((WORD) 0x0000)
  246. #define trpidUnresolved             ((WORD) 0x0001)
  247. #define trpidResolvedNSID           ((WORD) 0x0002)
  248. #define trpidResolvedAddress        ((WORD) 0x0003)
  249. #define trpidOneOff                 ((WORD) 0x0004)
  250. #define trpidGroupNSID              ((WORD) 0x0005)
  251. #define trpidOffline                ((WORD) 0x0006)
  252. #define trpidIgnore                 ((WORD) 0x0007)
  253. #define trpidClassEntry             ((WORD) 0x0008)
  254. #define trpidResolvedGroupAddress   ((WORD) 0x0009)
  255. typedef struct _trp
  256. {
  257.     WORD    trpid;
  258.     WORD    cbgrtrp;
  259.     WORD    cch;
  260.     WORD    cbRgb;
  261.  
  262. } TRP, *PTRP, *PGRTRP, FAR * LPTRP;
  263. #define CbOfTrp(_p)     (sizeof(TRP) + (_p)->cch + (_p)->cbRgb)
  264. #define LpszOfTrp(_p)   ((LPSTR)(((LPTRP) (_p)) + 1))
  265. #define LpbOfTrp(_p)    (((LPBYTE)(((LPTRP)(_p)) + 1)) + (_p)->cch)
  266. #define LptrpNext(_p)   ((LPTRP)((LPBYTE)(_p) + CbOfTrp(_p)))
  267.  
  268. typedef DWORD XTYPE;
  269. #define xtypeUnknown    ((XTYPE) 0)
  270. #define xtypeInternet   ((XTYPE) 6)
  271.  
  272. #define cbDisplayName   41
  273. #define cbEmailName     11
  274. #define cbSeverName     12
  275. typedef struct _ADDR_ALIAS
  276. {
  277.     char    rgchName[cbDisplayName];
  278.     char    rgchEName[cbEmailName];
  279.     char    rgchSrvr[cbSeverName];
  280.     ULONG   dibDetail;
  281.     WORD    type;
  282.  
  283. } ADDRALIAS, FAR * LPADDRALIAS;
  284. #define cbALIAS sizeof(ALIAS)
  285.  
  286. #define cbTYPE              16
  287. #define cbMaxIdData         200
  288. typedef struct _NSID
  289. {
  290.     DWORD   dwSize;
  291.     unsigned char   uchType[cbTYPE];
  292.     XTYPE   xtype;
  293.     LONG    lTime;
  294.  
  295.     union
  296.     {
  297.         ADDRALIAS   alias;
  298.         char        rgchInterNet[1];
  299.  
  300.     } address;
  301.  
  302. } NSID, * LPNSID;
  303. #define cbNSID sizeof(NSID)
  304.  
  305.  
  306. /* -------------------------- */
  307. /* TNEF Down-level Priorities */
  308. /* -------------------------- */
  309.  
  310. #define prioLow     3
  311. #define prioNorm    2
  312. #define prioHigh    1
  313.  
  314.  
  315. /* ------------------------------------- */
  316. /* TNEF Down-level Attributes/Properties */
  317. /* ------------------------------------- */
  318.  
  319. #define atpTriples      ((WORD) 0x0000)
  320. #define atpString       ((WORD) 0x0001)
  321. #define atpText         ((WORD) 0x0002)
  322. #define atpDate         ((WORD) 0x0003)
  323. #define atpShort        ((WORD) 0x0004)
  324. #define atpLong         ((WORD) 0x0005)
  325. #define atpByte         ((WORD) 0x0006)
  326. #define atpWord         ((WORD) 0x0007)
  327. #define atpDword        ((WORD) 0x0008)
  328. #define atpMax          ((WORD) 0x0009)
  329.  
  330. #define LVL_MESSAGE     ((BYTE) 0x01)
  331. #define LVL_ATTACHMENT  ((BYTE) 0x02)
  332.  
  333. #define ATT_ID(_att)                ((WORD) ((_att) & 0x0000FFFF))
  334. #define ATT_TYPE(_att)              ((WORD) (((_att) >> 16) & 0x0000FFFF))
  335. #define ATT(_atp, _id)              ((((DWORD) (_atp)) << 16) | ((WORD) (_id)))
  336.  
  337. #define attNull                     ATT( 0,             0x0000)
  338. #define attFrom                     ATT( atpTriples,    0x8000) /* PR_ORIGINATOR_RETURN_ADDRESS */
  339. #define attSubject                  ATT( atpString,     0x8004) /* PR_SUBJECT */
  340. #define attDateSent                 ATT( atpDate,       0x8005) /* PR_CLIENT_SUBMIT_TIME */
  341. #define attDateRecd                 ATT( atpDate,       0x8006) /* PR_MESSAGE_DELIVERY_TIME */
  342. #define attMessageStatus            ATT( atpByte,       0x8007) /* PR_MESSAGE_FLAGS */
  343. #define attMessageClass             ATT( atpWord,       0x8008) /* PR_MESSAGE_CLASS */
  344. #define attMessageID                ATT( atpString,     0x8009) /* PR_MESSAGE_ID */
  345. #define attParentID                 ATT( atpString,     0x800A) /* PR_PARENT_ID */
  346. #define attConversationID           ATT( atpString,     0x800B) /* PR_CONVERSATION_ID */
  347. #define attBody                     ATT( atpText,       0x800C) /* PR_BODY */
  348. #define attPriority                 ATT( atpShort,      0x800D) /* PR_IMPORTANCE */
  349. #define attAttachData               ATT( atpByte,       0x800F) /* PR_ATTACH_DATA_xxx */
  350. #define attAttachTitle              ATT( atpString,     0x8010) /* PR_ATTACH_FILENAME */
  351. #define attAttachMetaFile           ATT( atpByte,       0x8011) /* PR_ATTACH_RENDERING */
  352. #define attAttachCreateDate         ATT( atpDate,       0x8012) /* PR_CREATION_TIME */
  353. #define attAttachModifyDate         ATT( atpDate,       0x8013) /* PR_LAST_MODIFICATION_TIME */
  354. #define attDateModified             ATT( atpDate,       0x8020) /* PR_LAST_MODIFICATION_TIME */
  355. #define attAttachTransportFilename  ATT( atpByte,       0x9001) /* PR_ATTACH_TRANSPORT_NAME */
  356. #define attAttachRenddata           ATT( atpByte,       0x9002)
  357. #define attMAPIProps                ATT( atpByte,       0x9003)
  358. #define attRecipTable               ATT( atpByte,       0x9004) /* PR_MESSAGE_RECIPIENTS */
  359. #define attAttachment               ATT( atpByte,       0x9005)
  360. #define attTnefVersion              ATT( atpDword,      0x9006)
  361. #define attOemCodepage              ATT( atpByte,       0x9007)
  362. #define attOriginalMessageClass     ATT( atpWord,       0x0006) /* PR_ORIG_MESSAGE_CLASS */
  363.  
  364. #define attOwner                    ATT( atpByte,       0x0000) /* PR_RCVD_REPRESENTING_xxx  or
  365.                                                                    PR_SENT_REPRESENTING_xxx */
  366. #define attSentFor                  ATT( atpByte,       0x0001) /* PR_SENT_REPRESENTING_xxx */
  367. #define attDelegate                 ATT( atpByte,       0x0002) /* PR_RCVD_REPRESENTING_xxx */
  368. #define attDateStart                ATT( atpDate,       0x0006) /* PR_DATE_START */
  369. #define attDateEnd                  ATT( atpDate,       0x0007) /* PR_DATE_END */
  370. #define attAidOwner                 ATT( atpLong,       0x0008) /* PR_OWNER_APPT_ID */
  371. #define attRequestRes               ATT( atpShort,      0x0009) /* PR_RESPONSE_REQUESTED */
  372.  
  373. #ifdef __cplusplus
  374. }
  375. #endif
  376.  
  377. #ifdef __BORLANDC__
  378. #  include <poppack.h>
  379. #endif
  380.  
  381. #pragma option pop
  382. #endif  /*  defined TNEF_H */
  383.